package com.woniu.project.dao;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.woniu.project.core.domain.Management;
import com.woniu.project.core.domain.Permission;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author Klaus
 * @since 2020-10-13
 */
public interface PermissionMapper extends BaseMapper<Permission> {

    //查询所有的权限
    @Select("select permission_id,permission_name\n" +
            ",permission_addr,permission_type_id from pawn_permission\n")
    List<Permission> selectList();

    //根据权限地址或权限名称查询权限
    @Select("SELECT permission_id,permission_name,permission_addr\n" +
            ",permission_type_id from pawn_permission \n" +
            "where permission_name = #{permissionName} or permission_addr = #{permissionAddr}")
    Permission selectPermissionByNameOrAddr(@Param("permissionName") String permissionName,@Param("permissionAddr") String permissionAddr);

}
